/*
	flad : Copyright 2010 Dale J Williams

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
*/
package lads.flad.scene.cameras {
	
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import lads.flad.scene.SceneObject;
	
	/**
	 * Camera: A base script for camera pointing.
	 * @author Dale J Williams
	 * @version 1.0
	 */
	public class Camera {
		
		public var bounds	:Rectangle;
		public var name		:String;
		public var x		:Number = 0;
		public var y		:Number = 0;
		public var z		:Number = 0;	
		public var zoom		:Number = 1;
		public var target	:Object;
		
		private var point	:Point;
		
		public function Camera(name:String) {
			this.name = name;
		}
		
		public function start():void {
			update();
		}
		
		public function update():void {
			if (!target) return;
			x = target.x;
			y = target.y;
			z = target.z;
		}
		
		public function stop():void {
			return;
		}
		
		public function getAsPoint():Point {
			if (!point) point = new Point();
			point.x = x;
			point.y = y;
			return point;
		}
		
	}

}